//package com.example.thymeleaf.web.Interceptor;
//
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.PrintWriter;
//
///**
// * @Description: TODO
// * @author: 李展鹏
// * @date: 2024年05月31日11:06
// * 拦截器
// */
//public class AuthorizationInterceptor implements HandlerInterceptor {
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        System.out.println("****************************preHandle");
//        if (request.getSession().getAttribute("devUserSession")==null){
//            response.setContentType("text/html;charset=UTF-8");
//            PrintWriter out=response.getWriter();
//            out.println("<script>alert('请先进行登录，在进行后续操作(拦截器)!');location.href='"+request.getContextPath()+"/dev/toLogin';</script>");
//            return false;
//        }else {
//            return true;
//        }
//
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//        System.out.println("****************************postHandle");
////        HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//        System.out.println("****************************afterCompletion");
////        HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
//    }
//}